package com.cbd.pojo;

import java.io.Serializable;
import java.util.*;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.validation.annotation.Validated;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * 企业表
 * 
 **/
@Entity
@Table(name="company")
@Validated
public class Company implements Serializable{
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="companyID")
	private int companyID;
	/**
	 * 企业名称
	 * 
	 */
	@Column(name="companyName")
	@NotEmpty(message="不能为空")
	@Length(max=15,min=3,message="长度必须为3-15位之间")
	private String companyName;
	/**
	 * 企业楼层单位
	 * 
	 */
	@Column(name="companyAddress")
	@NotEmpty(message="不能为空")
	@Length(max=30,min=3,message="长度必须为3-30位之间")
	private String companyAddress;
	/**
	 * 企业负责人
	 * 
	 */
	@Column(name="companyBoss")
	@NotEmpty(message="不能为空")
	@Length(max=15,min=3,message="长度必须为3-15位之间")
	private String companyBoss;
	/**
	 * 企业联系电话  11位
	 * 
	 */
	@Column(name="companyTel")
	@NotEmpty(message="不能为空")
	@Length(max=11,min=11,message="长度必须为11位")
	private String companyTel;

	/**
	 * 与cbd平台签订的合同  将车位出租给平台
	 */
	 @OneToMany(mappedBy="company",cascade = CascadeType.ALL)
	 @JsonBackReference
	private List<Cbdpact> cbdpact;
	 
	/**
	 * 从cbd平台租车位的合同
	 */
	 @OneToMany(mappedBy="comp",cascade = CascadeType.ALL)
	 @JsonBackReference
	private List<Companypact> companypact;
	 
	 
	 @OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name="userID")
	private User user;
	/**
	 * @Fields type :1表示已删除
	 */ 
	@Column(name="type")
	private boolean type;
	public int getCompanyID() {
		return companyID;
	}

	public void setCompanyID(int companyID) {
		this.companyID = companyID;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public String getCompanyAddress() {
		return companyAddress;
	}

	public void setCompanyAddress(String companyAddress) {
		this.companyAddress = companyAddress;
	}

	public String getCompanyBoss() {
		return companyBoss;
	}

	public void setCompanyBoss(String companyBoss) {
		this.companyBoss = companyBoss;
	}

	public String getCompanyTel() {
		return companyTel;
	}

	public void setCompanyTel(String companyTel) {
		this.companyTel = companyTel;
	}

	public List<Cbdpact> getCbdpact() {
		return cbdpact;
	}

	public void setCbdpact(List<Cbdpact> cbdpact) {
		this.cbdpact = cbdpact;
	}

	public List<Companypact> getCompanypacct() {
		return companypact;
	}

	public void setCompanypacct(List<Companypact> companypacct) {
		this.companypact = companypacct;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}


	public List<Companypact> getCompanypact() {
		return companypact;
	}

	public void setCompanypact(List<Companypact> companypact) {
		this.companypact = companypact;
	}


	public boolean isType() {
		return type;
	}

	public void setType(boolean type) {
		this.type = type;
	}

	
}